#pragma once
#include "Plane.h"

class Frustum
{
public:
    enum FrustumPlane
    {
        FRUSTUM_PLANE_NEAR   = 0,
        FRUSTUM_PLANE_FAR    = 1,
        FRUSTUM_PLANE_LEFT   = 2,
        FRUSTUM_PLANE_RIGHT  = 3,
        FRUSTUM_PLANE_TOP    = 4,
        FRUSTUM_PLANE_BOTTOM = 5
    };

public:
	Frustum() {}
	Frustum(const Matrix& proj);
	virtual ~Frustum() {}

	void Init(const Matrix& proj);

	bool Visible(const AxisAlignedBox& box);
	bool Visible(const BoxCenterAndExtent& box);
	bool Visible(const Vector4& center, const Vector4& extent);
	bool Visible(const Vector3& center, float radius);

private:
	Plane mPlanes[6];
	Plane mPermutedPlanes[8];
	
	void Build();
};
